import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'loyout',
      component: () => import('@renderer/views/Loyout.vue'),
      redirect: { name: 'home' },
      children: [
        {
          path: 'search',
          name: 'search',
          component: () => import('@renderer/views/Search.vue'),
          props: (route) => ({
            keyword: route.query.keyword
          })
        },
        {
          path: 'play-list',
          name: 'play-list',
          component: () => import('@renderer/views/PlayList.vue')
        },
        {
          path: 'login',
          name: 'login',
          component: () => import('@renderer/views/header/Login.vue')
        },
        {
          path: 'home',
          name: 'home',
          component: () => import('@renderer/views/Home.vue')
        },
        {
          path: 'setting',
          name: 'setting',
          component: () => import('@renderer/views/header/Setting.vue')
        },
        {
          path: 'library',
          name: 'library',
          component: () => import('@renderer/views/Library.vue')
        },
        {
          path: 'track-album',
          name: 'track-album',
          component: () => import('@renderer/views/track/AlbumInfo.vue')
        },
        {
          path: 'track-artist/:mid',
          name: 'track-artist',
          component: () => import('@renderer/views/track/ArtistInfo.vue')
        },
        {
          path: '/:pathMatch(.*)*',
          component: () => import('@renderer/views/404.vue')
        }
      ]
    }
  ]
})

export default router
